#ifndef FOOTMARKLISTVIEW_H
#define FOOTMARKLISTVIEW_H

#include <QWidget>
#include <QVBoxLayout>
#include <QPaintEvent>
#include <QFont>
#include <QPointF>
#include <QString>

#include <QLineEdit>
#include <QComboBox>
#include <QPushButton>
#include <QStackedLayout>

#include <QVariantMap>


#include "kesyssetting.h"
#include "mcore/map/MapObject.h"

#include "fmtableview.h"
#include "../../page/pagewidgetmini.h"
#include "kemode/dao/wp/KeFootmarkDao.h"


namespace kepen {
namespace core {

class FootmarkListView : public QWidget
{
    Q_OBJECT
public:
    explicit FootmarkListView(QWidget *parent
                              ,KeSysSetting *config
                              ,QStackedLayout*lay);
    ~FootmarkListView();

public:
    void setDataSource(kepen::core::MapObject* map
                       ,kepen::kemod::KeFootmarkDao *d);
    bool eventFilter(QObject * watched, QEvent * event)override;

    QPushButton* getBtnClose();

    int gotoPage(int nToPage);
    void focusTableView();
private:
    void initWidget(KeSysSetting *conf);

    QWidget *buildHead(QWidget *parent, KeSysSetting *conf);
    QWidget *builSearch(QWidget *parent);
    QWidget *buildUpdate(QWidget *parent);
    QWidget *buildPageWidget(QWidget *parent);


    void clearWhereClause();
    void getWhereClause(QVariantMap &andWhere)const;

    void locateBy(const QString nodeId);
private:
    kepen::core::MapObject *mapSurface;
    KeSysSetting *mSysConfig;
    QLineEdit * inputSearch;
    QAction* searchAction;
    FmTableView *mTableView;
    PageWidgetMini *mPageWidget;

    QPushButton* mBtnClose;
    QStackedLayout* stackedLayout;

    kepen::kemod::KeFootmarkDao *dao;
    QFont fontIconThird;
Q_SIGNALS:


private Q_SLOTS:
    void onInputSearch();
    void onBtnDataSyncClicked();
    void onBtnMoreMenuClicked();




    void onKeyPress4Page(int key);

    void onRowDblClicked(const QModelIndex &index);

    void onBtnClickedNew();
    void onBtnClickedUpdate();
    void onBtnClickedDelete();
    void onBtnClickedLocate();


    void onStackedClosed(quint32 flag,QWidget*widge);


    void searchTextChanged(const QString &text);
};


}
}
#endif // FOOTMARKLISTVIEW_H
